<?php
function MysqlService ()
{
  $mysqli = mysqli_init();
  if (!$mysqli) {
      trigger_error("mysqli init failed", E_USER_ERROR);
  }

  if (!$mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 5)) {
      trigger_error('Setting MYSQLI_OPT_CONNECT_TIMEOUT failed');
  }
  $hostName = "localhost";
 
   if (!$mysqli->real_connect($hostName, 'testuser', 'testpw', 'amfPhpTestData'))
   {
   	   trigger_error(mysqli_connect_error(), E_USER_ERROR);
   }
   
   return $mysqli;
}
?>
